package com.jk.controller;

import com.jk.item.pojo.ItemCat;
import com.jk.item.service.ItemCatService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author cuiP
 * Created by cuip on 2017/6/24.
 */
@Controller
@RequestMapping("/item/cat")
public class ItemCatController {

    @Resource
    private ItemCatService itemCatService;

    @ResponseBody
    @RequestMapping(value = "/list", method = RequestMethod.POST)
    public List<ItemCat> getItemCatTreeList(@RequestParam(value = "id", defaultValue = "0") Long parentId){
        return itemCatService.getItemCatList(parentId);
    }

}
